<template>
  <div class="charts" ref="charts">
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  name: "index",
  mounted() {
    // 初始化echarts实例
    let lineCharts = echarts.init(this.$refs.charts);
    // 配置数据
    lineCharts.setOption(
      {
        xAxis: {
          show: false,
          min:0,
          max:100,
        },
        yAxis: {
          show: false,
          type: 'category'
        },
        // 系列
        series: [
          {
            type: 'bar',
            data: [45],
            barWidth:12,
            color:'yellowgreen',
            //背景颜色
            showBackground:true,
            backgroundStyle:{
              color:'#eee'
            },
            label:{
              show:true,
              formatter:'|',
              position:'right'
            },
          }
        ],
        // 布局调试
        grid: {
          left: 0,
          top: 0,
          right: 0,
          bottom: 0,
        }
      }
    )
  }

}
</script>

<style scoped>
.charts {
  width: 100%;
  height: 100%;
}
</style>
